using UnityEngine;

namespace Super
{
	public class DontDestroyRoot : MonoBehaviour
	{
		private void Awake()
		{
			GameObject go = DataHelperUtil.FindDontDestroyObject(name);
			if (go != null)
			{
				Destroy(gameObject);
				return;
			}

			if (Application.isPlaying)
				GameObject.DontDestroyOnLoad(gameObject);
			DataHelperUtil.AddDontDestroyObject(gameObject);
		}
	}

}
